<template>
    <div>
        <el-form :inline="true" :model="seachFrom" size="mini">
            <el-form-item label="操作人名称">
                <el-input v-model.trim="seachFrom.uname"></el-input>
            </el-form-item>
            <el-form-item>
                <el-button icon='el-icon-search' type="primary" @click="handleCheck">查询</el-button>
                <el-button icon='el-icon-refresh' class="filter-item" @click="handleReset">重置</el-button>
            </el-form-item>
        </el-form>

        <el-table
                :data="tableData"
                border
                style="width: 100%">
            <el-table-column
                    prop="gmtCreate"
                    label="操作日期"
            >
            </el-table-column>
            <el-table-column
                    prop="uname"
                    label="姓名"
                    width="180">
            </el-table-column>
            <el-table-column
                    prop="action"
                    label="操作内容">
            </el-table-column>

            <!--分页-->
            <el-pagination
                    @size-change=handleSizeChange
                    @current-change=handleCurrentChange
                    :current-page=currentPage
                    :page-sizes=pageSizes
                    :page-size=pagesize
                    layout="total, sizes, prev, pager, next, jumper"
                    :total=total>
            </el-pagination>
        </el-table>
    </div>
</template>



<script>
    export default {
        name: "caozuolog",
        data() {
            return {
                tableData:[],
                currentPage:1,
                pagesize:5,
                pageSizes:[5,10,15,20],
                total:0,
                seachFrom:{},
            }
        },
        created() {
            this.initTable();
        },
        methods:{
            //表格排序规则
            formatter(row, column) {
                return row.address;
            },
            initTable(){
                var that =this
                this.$http.post("/caozuolog/findAllLog/"+this.currentPage+"/"+this.pagesize,this.seachFrom).then(function (result) {
                            console.log(result)
                    if (result.data.code===2000) {

                        that.tableData = result.data.data.records
                    }
                    console.log(result.data.data.records)
                })
            },
            //分页点击事件
            handleSizeChange(val) {
                this.pagesize=val;
                this.initTable();
            },
            handleCurrentChange(val) {
              this.currentPage=val;
                this.initTable();

            },
            // 刷新当前页面
            reload() {
                this.seachFrom = {}
                this.initTable();
            },
                //查询
             handleCheck() {
                 this.initTable();
             },
            // 重置查询条件
            handleReset() {
                this.reload()
            },

        }
    }
</script>

<style scoped>

</style>